<%--
  Created by IntelliJ IDEA.
  User: 陈鹏
  Date: 2021/3/30
  Time: 12:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style>
        .answer-box .answer-fram{
            background-color: #5ba5c9;
            width: 650px;
            margin: 0 auto 0 auto;
        }
        .aid-div{
            background-color: #e36464;
            width: 150px;
            height: 50px;
        }
        .reply-div{
            background-color: #f4f4f4;
            width: 400px;
            height: 50px;
        }
    </style>
</head>
<body>
<div class="answer-box">
    {{title}}
    <div class="answer-fram">
        <table class="answer-fram">
            <tbody>
            <tr v-for="answer in answers">
                <td>
                    <div class="aid-div">{{answer.aid}}</div>
                </td>
                <td>
                    <div class="reply-div">{{answer.replyContent}}</div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<script src="/comms/vue.js"></script>
<script src="/comms/jquery.js"></script>
<script>
    function request(url, method, fn, data) {
        $.ajax({
            url: url,
            data: data,
            method: method,
            dataType: "json",
            success: fn
        })
    }
</script>
<script>
    let v=new Vue({
        el:".answer-box",
        data:{
            title:"Answer",
            answers:[]
        },
        created:function () {
            console.log("创建");
            this.initAnswer();
        },
        methods:{
            initAnswer: function () {
                let this_ = this;
                request("/remark/selectAnswer?rid=${sessionScope.rid}", "GET", function (data) {
                    if (data.flag) {
                        this_.answers = data.data;
                        console.log(data)
                    } else {
                        console.log("noData")
                    }
                })
            },
        }
    })
</script>
</body>
</html>
